using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;


namespace weather
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Window : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Timer timer1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.LinkLabel linkLabel1;
		private System.ComponentModel.IContainer components;
		private Tray t;
		
		public Window(Tray tr)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			timer1.Start();
			t = tr;
			this.Show();
			this.Activate();
            linkLabel1.Text = t.Temperature + " degrees";
			this.Text = "Boulder Weather " + t.Temperature + " degrees";
			
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{

			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Window));
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.button1 = new System.Windows.Forms.Button();
			this.linkLabel1 = new System.Windows.Forms.LinkLabel();
			this.SuspendLayout();
			// 
			// timer1
			// 
			this.timer1.Interval = 300000;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// button1
			// 
			this.button1.BackColor = System.Drawing.SystemColors.ActiveCaption;
			this.button1.ForeColor = System.Drawing.Color.Yellow;
			this.button1.Location = new System.Drawing.Point(0, 72);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(168, 23);
			this.button1.TabIndex = 1;
			this.button1.Text = "Refresh";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// linkLabel1
			// 
			this.linkLabel1.Location = new System.Drawing.Point(8, 24);
			this.linkLabel1.Name = "linkLabel1";
			this.linkLabel1.TabIndex = 2;
			this.linkLabel1.TabStop = true;
			this.linkLabel1.Text = "Not Updated";
			this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
			// 
			// Window
			// 
			this.AutoScale = false;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.SystemColors.Info;
			this.ClientSize = new System.Drawing.Size(168, 94);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.linkLabel1,
																		  this.button1});
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.Name = "Window";
			this.Opacity = 0.800000011920929;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Boulder Weather";
			this.Closed += new System.EventHandler(this.Window_Close);
			this.ResumeLayout(false);

		}
		#endregion

		

		

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			linkLabel1.Text = t.Temperature + " degrees";
			this.Text = "Boulder Weather " + t.Temperature + " degrees";
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			t.refresh();
			linkLabel1.Text = t.Temperature + " degrees";
			this.Text = "Boulder Weather " + t.Temperature + " degrees";
		}

		private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
			Radar radar = new Radar();
		}

		private void Window_Close(object sender, System.EventArgs e)
		{
			this.Dispose();
		}


		
	}
}
